package src.lab02.test30;

import java.util.Scanner;

/**
 * Created by 林云志 on 2017/11/16.
 */
public class Test30 {
    public static void main(String[] args) {
        //30、 	从键盘读取一个考试分数列表，计算它们的平均分。

        System.out.println("请输入输入成绩的个数");
        Scanner scanner = new Scanner(System.in);
        int number = scanner.nextInt();
        double [] grade = new double [number];
        int i = 0;


        try{
        for (;i<grade.length;i++) {
            System.out.println("请输入成绩：");
           double grades = scanner.nextDouble();
            grade[i] =  grades;}

        }
        catch (Exception e){
            System.out.println("请输入数字!!");
            System.out.println("请重新输入成绩:");

        }

        finally {
            System.out.print("输入的成绩为：");
            for (int j = 0;j<grade.length;j++){
                System.out.print(grade[j]+"   ");
            }
        }



    }
}
